<template>
     <div class="mui-numbox" data-numbox-min='1' >
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="numboxcount" @change="countChanged" ref="numbox" />
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>
 
<script>
// import mui from "../../lib/mui/js/mui"
export default {
    data(){
        return {

        }
    },

    mounted(){
        // mui("mui-numbox").numbox();
 
        
    },


    methods: {
        countChanged() {
            // 每当文本框的数据改变是，就会把子组件的值传递给父组件
            console.log(this.$refs.numbox.value);
            this.$store.commit("updateToCar", {
                id: this.numboxId,
                count: parseInt(this.$refs.numbox.value)
            });

        }
    },
    props:[
        "numboxcount",
        "numboxId"
    ]
    
}
</script>


<style lang="scss" scoped>
.mui-numbox{
    height: 25px;
}
</style>